package com.greendragon.persistence.domain; 

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/** 
 * @author wulibin, exceptsky@gmail.com, 2011-9-23 上午09:09:24
 * 
 */
@Entity
@Table(name="page")
public class Page implements Serializable{
	private static final long serialVersionUID = -2258469859886360828L;
	
	private Long id;
	private String title;													//标题
	private String htmlContent;												//Html代码		
	private User author;													//创建者
	private Integer commentNum = new Integer(0);							//评论数
	private Boolean allowComment = new Boolean(true);						//是否允许评论
	private Boolean allowAnonymousComment = new Boolean(false);				//是否允许匿名评论
	private Date createdAt;													//创建日期
	private Date modifiedAt;												//最后修改日期
	
	public Page(){}

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}
	
	@Column(name="title", length=50)
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@Lob
	@Column(name="htmlContent", length=50)
	public String getHtmlContent() {
		return htmlContent;
	}

	public void setHtmlContent(String htmlContent) {
		this.htmlContent = htmlContent;
	}
	
	@ManyToOne
	@JoinColumn(name="author_id")
	public User getAuthor() {
		return author;
	}

	public void setAuthor(User author) {
		this.author = author;
	}

	@Column(name="commentNum")
	public Integer getCommentNum() {
		return commentNum;
	}

	public void setCommentNum(Integer commentNum) {
		this.commentNum = commentNum;
	}

	@Column(name="allowComment")
	public Boolean getAllowComment() {
		return allowComment;
	}

	public void setAllowComment(Boolean allowComment) {
		this.allowComment = allowComment;
	}
	
	@Column(name="allowAnonymousComment")
	public Boolean getAllowAnonymousComment() {
		return allowAnonymousComment;
	}

	public void setAllowAnonymousComment(Boolean allowAnonymousComment) {
		this.allowAnonymousComment = allowAnonymousComment;
	}

	@Column(name="createdAt")
	@Temporal(TemporalType.TIMESTAMP)
	public Date getCreatedAt() {
		return createdAt;
	}

	public void setCreatedAt(Date createdAt) {
		this.createdAt = createdAt;
	}
	@Column(name="modifiedAt")
	@Temporal(TemporalType.TIMESTAMP)
	public Date getModifiedAt() {
		return modifiedAt;
	}

	public void setModifiedAt(Date modifiedAt) {
		this.modifiedAt = modifiedAt;
	}
	
}
 